//FULLY CONVERTED...UNTESTED

using System.Collections;
using System;
using UnityEngine;


public class Block: MonoBehaviour{
	public enum blockType{LOGIC, ETHICS, PASSION, DECEPTION};	
	
	private blockType type;
	private int health;
	private int height;
	ArrayList effects;
	
	public Block(blockType type){
		this.type=type;
		switch(type){
			case blockType.LOGIC:
				health=40;
				height=8;
				break;
			case blockType.ETHICS:
				health=30;
				height=14;
				break;
			case blockType.DECEPTION:
				health=30;
				height=20;
				break;
			case blockType.PASSION:
				health=20;
				height=20;
				break;
		}
		effects=new ArrayList();
	}
	
	public Block(blockType type, int health, int height) : 
		this(type,health,height,new ArrayList()){}
		
	public Block(blockType type, int health, int height, ArrayList effects){
		this.type = type;
		this.health = health;
		this.height = height;
		this.effects=effects;
	}
	
	public int getHeight(){
		return height;
	}
	
	public void setType(int itype){
		switch(itype){
			case(0): type=blockType.LOGIC; break;
			case(1): type=blockType.ETHICS; break;
			case(2): type=blockType.PASSION; break;
			case(3): type=blockType.DECEPTION; break;
		}
	}
	
	public int getType()
	{
		switch (type)
		{
			case blockType.LOGIC: return 0; //Blue
			case blockType.ETHICS: return 1; //Yellow
			case blockType.PASSION: return 2; //Red
			case blockType.DECEPTION: return 3; //Grey
			default: return 0;
		}
	}

	public void takeDamage(int damage){
		health -= damage;	
		if (health<=0) health=0;
	}
	
	public int getHealth()
	{
		return health;
	}
	
	public bool isDead(){
		return (health <= 0);
	}
	
	public string tostring()
	{
		string s = "Block: ";
		switch (type)
		{
			case blockType.LOGIC: s+= "Logic, ";break; //Blue
			case blockType.ETHICS: s+= "Ethics, ";break; //Yellow
			case blockType.PASSION: s+= "Passion, ";break; //Red
			case blockType.DECEPTION: s+= "Deception, ";break; //Grey
		}
		s+= "Health: " + health + ", Height: " + height;
		return s;
	}

	public void setHealth(int i) {
		this.health = i;
	}

	public void setHeight(int magnitude) {
		this.height = magnitude;
	}
	
	
	
}	